package com.le.tester.book.effectivejava3rdchinese.articlesixty;


/**
 * createTime：2022/9/7 10:00
 * description：丢失精度的问题
 */
public class Demo {

    public static void main(String[] args) {

        double funds = 1.00;
        int itemsBought = 0;
        for (double price = 0.10; funds >= price; price += 0.10) {
            funds -= price;
            itemsBought++;
        }
        System.out.println(itemsBought + "item bought");
    }


}
